package io.gitee.zhangbinhub.admin.resource.server

import com.fasterxml.jackson.databind.ObjectMapper
import io.gitee.zhangbinhub.acp.boot.interfaces.LogAdapter
import io.gitee.zhangbinhub.admin.resource.server.hystrix.CommonOauthServerHystrix
import io.gitee.zhangbinhub.admin.resource.server.hystrix.WorkFlowServerHystrix
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration
import org.springframework.cloud.openfeign.EnableFeignClients
import org.springframework.context.annotation.Bean

/**
 * @author zhang by 12/12/2019
 * @since JDK 11
 */
@AutoConfiguration(after = [BlockingLoadBalancerClientAutoConfiguration::class])
@EnableFeignClients
class AcpAdminResourceServerFeignClientAutoConfiguration {
    @Bean
    fun commonOauthServerHystrix(logAdapter: LogAdapter, objectMapper: ObjectMapper): CommonOauthServerHystrix =
        CommonOauthServerHystrix(logAdapter, objectMapper)

    @Bean
    fun workFlowServerHystrix(logAdapter: LogAdapter, objectMapper: ObjectMapper): WorkFlowServerHystrix =
        WorkFlowServerHystrix(logAdapter, objectMapper)
}